<?php
namespace App\Http\Controllers\Wechat\Shop;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repos\ShopRechargeRepo;
use App\Http\Requests\Api\Shop\ShopRechargeRequest;


class RechargeController extends Controller
{
    public function recharge(ShopRechargeRequest $request)
    {
    	$rs['status'] = false;
    	$data = $request->pure();
        $data['openid'] = $request->shopUser->openid;
    	$data['code'] = orderCode('R',$request->shopUser->shop_id);
        $data['shop_id']      = $request->shopUser->shop_id;
        $data['shop_user_id'] = $request->shopUser->id;  
        $data['source'] = 1; //店铺自充
        // if($data['money']<10000) {
        //     $rs['msg'] = '充值金额不能小于100元';
        //     return response()->json($rs);
        // }	
    	$ret = ShopRechargeRepo::create($data);
    	if($ret) {
    		$rs['status'] = true;
    		$rs['data']   = $ret;
    	}
    	return response()->json($rs);
    }

    

   
}
